<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>状态监控-测点列表</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/page_css/util.css">
</head>

<body>
    <div class="mui-content">
      <ul class="mui-table-view01">
			 <li class="search-cell">
			 	<div class="mui-input-row mui-search">
					<input type="search" id="searchText" class="mui-input-clear" placeholder="请输入测量编号" ><span class="mui-icon mui-icon-clear mui-hidden"></span><span class="mui-placeholder"><span></span></span>
				</div>
				<div class="mui-btn mui-btn-primary" onclick="Search()">
					搜索
				</div>
			 </li>
		</ul>
    	<!-- <div class="mui-input-row mui-search">
			  <input type="search" class="mui-input-clear" placeholder=""><span class="mui-icon mui-icon-clear mui-hidden"></span><span class="mui-placeholder"><span class="mui-icon mui-icon-search"></span>请输入关键字搜索<span></span></span>

      </div> -->
		<div class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-primary segmentedControl">
			<a class="mui-control-item" tapmode  onclick="openSaveWin('work_order_sel_address','选择位置')" id="LocationName">位置</a>
			<a class="mui-control-item" tapmode onclick="openSaveWin('work_order_sel_property','选择资产')" id="propertyName">资产</a>
			<a class="mui-control-item" tapmode onclick="openSaveWin('work_order_sel_manager','选择人员',{manager:true})" id="managerName">测量人</a>
		</div>
    	<ul class="mui-table-view deal_list" id="deal_list">
			 <!-- 模板引擎 -->
		</ul>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
<script type="text/template" id="tmpList">
  {{each datas as item}}
    <li class="mui-table-view-cell" onclick="goDetail('{{item.pointnum}}','{{item.measurepointid}}')">
     <div class="mui-table">
       <div class="mui-table-cell mui-col-xs-8">
         <h4 class="mui-ellipsis">测点编码:{{item.pointnum}}</h4>
         <p class="mui-h6 mui-ellipsis" style='font-weight:700;color:#000'>测点名称:{{item.description}}</p>
         <p class="mui-h6 mui-ellipsis">资产所属位置:{{item.location}}</p>
       </div>
       <div class="mui-table-cell mui-col-xs-4 mui-text-right">
         <span class="mui-h5">资产:{{item.assetDescription}}</span>
       </div>
       </div>
    </li>
  {{/each}}
</script>
<script type="text/javascript">
var searchText = $api.val($api.byId('searchText'));
var loadEnd = false;
var cRegion, assetnum, userID;
	apiready = function () {
    if (api.pageParam.cRegion) cRegion = api.pageParam.cRegion;
    onLoadData(curPage,false)
	scrollToBottomHandler(function() {
		if (!loadEnd) { // 没有结束时继续加载
			curPage++;
			onLoadData(curPage,true);
		} else { // 告诉到底了
			EndToast('到底了');
		}
	})
	Refresh(function() {
		tjsearch();
	});
    api.addEventListener({
		    name: 'LocactionId'
		}, function(ret, err) {
			cRegion = ret.value.locationName;
			$api.html($api.byId('LocationName'),ret.value.locationName)
			tjsearch();
		});
		api.addEventListener({
		    name: 'PropertyId'
		}, function(ret, err) {
			assetnum = ret.value.PropertyId;
			$api.html($api.byId('propertyName'),ret.value.description)
			tjsearch();
		});
		api.addEventListener({
		    name: 'ManagerCh'
		}, function(ret, err) {
			userID = ret.value.userID;
			$api.html($api.byId('managerName'),ret.value.userName)
			tjsearch();
		});
	}
  function onLoadData(curPage,load){
  	searchText = $api.val($api.byId('searchText'));
     ajaxrd("queryPointList",{
       location: api.pageParam.cRegion || cRegion,
       assetnum: assetnum || api.pageParam.assetnum,
       inspector: userID,
       pointnum: searchText,
       pageNo: curPage,
       pageSize: 10
     },function(data){
     	api.refreshHeaderLoadDone();
        AddData('tmpList','deal_list', data.list, load);
        if (data.list.length && data.list.length < 10) {
    			loadEnd = true
    		}
     })
  }
  function goDetail(num,id){
    openWin('status_monitoing_result','测量结果',{
        background: '#6098de',
        color: '#fff',
        rightButtons:[{
          iconPath:"widget://image/newPage.png"
        }]
    },{
        num:num,
        id:id
    })
  }
</script>
</html>
